package main;

import com.paypal.core.PayPalEnvironment;
import com.paypal.core.PayPalHttpClient;
import com.paypal.http.HttpResponse;
import com.paypal.http.serializer.Json;
import com.paypal.orders.Order;
import com.paypal.orders.OrdersCaptureRequest;
import com.paypal.orders.OrdersGetRequest;
import org.json.JSONObject;

import java.io.IOException;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;

/**
 * @author : zGame
 * @version V1.0
 * @Project: rokectmqprac
 * @Package main
 * @Description: TODO
 * @date Date : 2022年01月21日 15:53
 */
public class Main {
    
    
    public static void main(String[] args) {
    
        Stu s = new Stu();
        s.setAge(1);
        System.out.println(s.hashCode());
        s.setAge(2);
        System.out.println(s.hashCode());
    
        //cap();
        //check();
    }
    
    public static void check(){
        String id = "AdrhgYxSpOV3szsgS_5hwakXeQ1vRspaijG0iGlZnJx_mMyRwGQEA94Uj6IXiNY6epJjTPfvUsvoA7J_";
        String sec = "EATJveK-TOfPEIbtqWPFA0rdS19_lqQ66ZzXA6xgNhIo4egYNtUtaSlZmCHgBKVY84MI3XvwxuOvPnnP";
        OrdersGetRequest request = new OrdersGetRequest("1R80173301024540H");
        PayPalHttpClient payPalHttpClient = new PayPalHttpClient(new PayPalEnvironment.Sandbox(id,sec));
        try {
            HttpResponse<Order> res = payPalHttpClient.execute(request);
            String json = new JSONObject(new Json().serialize(res.result())).toString(4);
            System.out.println(json);
        
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    public static void cap(){
        String id = "AdrhgYxSpOV3szsgS_5hwakXeQ1vRspaijG0iGlZnJx_mMyRwGQEA94Uj6IXiNY6epJjTPfvUsvoA7J_";
        String sec = "EATJveK-TOfPEIbtqWPFA0rdS19_lqQ66ZzXA6xgNhIo4egYNtUtaSlZmCHgBKVY84MI3XvwxuOvPnnP";
        OrdersCaptureRequest request = new OrdersCaptureRequest("9CV54923DV759971V");
        PayPalHttpClient payPalHttpClient = new PayPalHttpClient(new PayPalEnvironment.Sandbox(id,sec));
        try {
            HttpResponse<Order> res = payPalHttpClient.execute(request);
            String json = new JSONObject(new Json().serialize(res.result())).toString(4);
            System.out.println(json);
            
        } catch (IOException e) {
            e.printStackTrace();
        }
        Order order = new Order();
    }
}
